﻿@keyframes fadeaway {
    from {
        transform: scale(1) translateZ(0px);
        display: block;
    }

    to {
        transform: scale(0.75) translateZ(0px);
        opacity: 0;
    }
}

@keyframes fadein {
    from {
        transform: scale(1) translateZ(0px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateZ(0px);
        display: block;
    }
}

.fui-DialogSurface__backdrop {
    inset: 0px;
    background-color: rgba(0, 0, 0, 0.4);
    position: fixed;
    will-change: opacity;
    z-index: var(--zIndexModalBackdrop);
    display: none;

    &-fade {
        transition-duration: var(--modal-animation-duration, var(--durationGentle));
        transition-timing-function: var(--curveLinear);
        transition-property: opacity;
    }

    &-show {
        animation: fadein var(--modal-animation-duration, var(--durationGentle)) cubic-bezier(0, 0, 0, 1) forwards;
        display: block;
        opacity: 1;
    }

    &-hide {
        animation: fadeaway var(--modal-animation-duration, var(--durationGentle)) cubic-bezier(0, 0, 0, 1) forwards;
        display: none;
    }
}

.fui-DialogSurface {
    display: none;
    transform: scale(1) translateZ(0px);
    box-shadow: var(--shadow64);
    inset: 0px;
    padding: 24px;
    margin: var(--spacingVerticalXXXL) auto;
    border-style: solid;
    overflow: unset;
    border-width: 1px;
    border-top-color: var(--colorTransparentStroke);
    border-right-color: var(--colorTransparentStroke);
    border-bottom-color: var(--colorTransparentStroke);
    border-left-color: var(--colorTransparentStroke);
    border-bottom-right-radius: var(--borderRadiusXLarge);
    border-bottom-left-radius: var(--borderRadiusXLarge);
    border-top-right-radius: var(--borderRadiusXLarge);
    border-top-left-radius: var(--borderRadiusXLarge);
    user-select: unset;
    visibility: unset;
    position: fixed;
    height: fit-content;
    max-width: 600px;
    max-height: 100vh;
    box-sizing: border-box;
    background-color: var(--colorNeutralBackground1);
    color: var(--colorNeutralForeground1);
    z-index: var(--zIndexModal);

    &-centered {
        margin: auto;
    }

    &-fade {
        transition-timing-function: var(--curveDecelerateMid);
        transition-property: opacity, transform, box-shadow;
        transition-duration: var(--modal-animation-duration, var(--durationGentle));
    }

    &-show {
        animation: fadein var(--modal-animation-duration, var(--durationGentle)) cubic-bezier(0, 0, 0, 1) forwards;
        display: block;
        opacity: 1;
    }

    &-hide {
        animation: fadeaway var(--modal-animation-duration, var(--durationGentle)) cubic-bezier(0, 0, 0, 1) forwards;
        display: none;
    }

    .fui-DialogBody {
        overflow: unset;
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - 48px);
        box-sizing: border-box;

        .fui-DialogHeader {
            padding-bottom: var(--strokeWidthThick);
            margin: 0px;
            grid-area: 1 / 1 / 1 / 3;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }

        .fui-DialogTitle {
            font-family: var(--fontFamilyBase);
            font-size: var(--fontSizeBase500);
            font-weight: var(--fontWeightSemibold);
            line-height: var(--lineHeightBase500);
            margin: 0px;
        }

        .fui-DialogContent {
            flex-direction: column;
            display: flex;
            flex: 1 1 auto;
            padding-top: var(--strokeWidthThick);
            padding-right: var(--strokeWidthThick);
            padding-bottom: var(--strokeWidthThick);
            padding-left: var(--strokeWidthThick);
            margin-top: calc(var(--strokeWidthThick) * -1);
            margin-right: calc(var(--strokeWidthThick) * -1);
            margin-bottom: calc(var(--strokeWidthThick) * -1);
            margin-left: calc(var(--strokeWidthThick) * -1);
            font-family: var(--fontFamilyBase);
            font-size: var(--fontSizeBase300);
            font-weight: var(--fontWeightRegular);
            line-height: var(--lineHeightBase300);
            min-height: 32px;
            box-sizing: border-box;
            grid-area: 2 / 1 / 2 / 4;
        }

        .fui-DialogActions {
            gap: 8px;
            height: fit-content;
            box-sizing: border-box;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
        }
    }

    &-sm {
        max-width: 300px;
    }

    &-full {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
        border-radius: 0;

        .fui-DialogBody {
            height: 100%;
            border: 0;
        }

        .fui-DialogContent {
            overflow-y: auto;
        }
    }
}

@include media-breakpoint-up(sm) {
    .fui-DialogSurface-sm {
        max-width: $modal-sm;
    }
}

@include media-breakpoint-up(lg) {
    .fui-DialogSurface-lg,
    .fui-DialogSurface-xl {
        max-width: $modal-lg;
    }
}

@include media-breakpoint-up(xl) {
    .fui-DialogSurface-xl {
        max-width: $modal-xl;
    }
}
